import QtQuick 2.12
import QtQuick.Controls 2.12
import Translation 1.0

Switch {
    id: control
//    text: TransText.machineConf_IntelligentModel
//    font.family: Translation.family
//    font.pixelSize: Theme.font_size_13
//    font.styleName: Theme.font_family_regular
    implicitWidth: 42
    implicitHeight: 20

    indicator: Rectangle {
        id: bkRectangle
        anchors.fill: parent
        x: control.leftPadding
        y: parent.height / 2 - height / 2
        radius: height / 2
        color: control.checked ? "#3986FF" : "#D9D9D9"

        Rectangle {
            id : smallRect
            width: 14
            height: 14
            radius: height / 2
            color: "white"
            anchors.verticalCenter: parent.verticalCenter

            NumberAnimation on x{
                to: bkRectangle.width - smallRect.width - 3
                running: control.checked ? true : false
                duration: 80
            }

            NumberAnimation on x{
                to: 3
                running: control.checked ? false : true
                duration: 80
            }
        }
    }
}
